#include "stdafx.h"
#include "Manipulator.h"
#include <iostream>

using namespace std;

char SPECIAL_CONTRACT[] = "Special";
char EXOTIC_CONTRACT[] = "Exotic";

nef::nef_export<ComponentManipulator> cm_export;

size_t ComponentManipulator::AvailableNumberOfOperations() const
{
	return _components.size();
}

std::vector<std::string> ComponentManipulator::CallAllOperations( const std::string &a, const std::string &b ) const
{
	std::vector<std::string> ret;

	cout << "Separator: " << _separator->GetSeparator() << endl;

	for (auto op : _components)
	{
		cout << op->GetDescription() << endl;
		ret.push_back(op->ManipulateString(a, b));
	}



	return ret;
}

void ComponentManipulator::SetSpecialComponent( const IMyComponent::Ptr &cp )
{
	_specialComponent = cp;
}

void ComponentManipulator::SetExoticComponents( const ComponentListPtr &exoComps )
{
	_exoComps = exoComps;
}

void ComponentManipulator::OnImportsSatisfied()
{
	if (!_specialComponent && !_components.empty())
		_specialComponent = _components.back();
}
